import { createRouter, createWebHistory } from "vue-router";
import NProgress from "nprogress";
import "nprogress/nprogress.css";
import container from "./container";

const router = createRouter({
  history: createWebHistory(),
  routes: container
});

// 前置路由守卫
router.beforeEach((to, from, next) => {
  NProgress.start();
  // window.scrollTo(0, 0); // 跳转后置顶
  next();
});
// 后置路由守卫
router.afterEach(() => {
  NProgress.done();
});

export default router;
